1. Field of the Invention
The present invention relates to an apparatus and a method of mirroring firmware and data, and in particular, to an apparatus and a method of mirroring firmware and data for an embedded system that mirrors firmware and data stored on a main flash memory of the embedded system to be operated on a secondary flash memory and when the main flash memory is damaged, the mirrored secondary flash memory is used instead of the damaged main flash memory to prevent the loss of data and stably maintain the system operation.
This work was supported by the IT R&D program of MIC/IITA [2006-S-038-02, Development of Device-Adaptive Embedded Operating System for Mobile Convergence Computing].
2. Description of the Related Art
An embedded system refers to a control system that has a processor built therein to manipulate the device in order to perform a predetermined specific function and is used to control the functions of various electronics, electric home appliances, and mechanical apparatuses. The embedded system includes a main control unit (MCU) and programs that are loaded therein so as to perform a specific function by operating the MCU. The embedded system has a basic computing ability that becomes compatible for the purpose of an apparatus and uses an application suitable for the purpose thereof to perform the control operation. The embedded system uses a small sized memory, which minimizes the size of the hardware while reducing the cost and optimizing the performance. Generally, the embedded system uses an embedded Linux as an operating system (OS). However, the embedded system does not use a high capacity hard disk in order to store the OS and programs, but manages the programs and resources through a memory apparatus.
A basic structure of an embedded system according to the related art is configured by a boot ROM, a flash memory, an SDRAM, a network device, and other devices in addition to a CPU. The boot RROM is a nonvolatile memory and stores a boot loader that is a start code of a system. The SDRAM (Synchronous Dynamic RAM) is a volatile memory and manages the application and the resources. The flash memory is a nonvolatile memory and manages the data backup.
FIG. 1 is a diagram illustrating the data backup of an embedded system according to the related art.
A backup method of an embedded system according to the related art includes: allocating a flash disk space for storing back-up data to a flash memory where an OS image storage and an RAM disk image storage are allocated thereto; formatting data of the flash disk; registering a file system for managing files and folders, which are stored on the flash disk, as a kernel of the OS; and storing back-up data on the flash disk as units of blocks.
The registering of a file system in the flash disk mounts JFFS2 (Journaling flash file system version 2) onto the flash disk.
The storing of backup data on the flash disk as units of blocks accesses to the flash disk as units of blocks using an MTD (Memory Technology Devices). This method further includes: converting the backup data stored on the flash disk into one backup file; uploading the backup file onto a memory of an external apparatus connected through a LAN (Local Area Network) using an FTP (File Transfer Protocol) method; and downloading and storing the backup file from the external apparatus connected through the LAN when rebooting the system.
As shown in FIG. 1, a flash disk 38 for storing the backup data is allocated into a storage of a flash memory on which a kernel 34 and a RAM disk 36 are stored and accessed as units of blocks to transmit and read out the data. In the case of total 16 Mbytes of flash memory, the flash memory for the embedded system divides 2 Mbytes into 1 Mbyte of first kernel 34 and 1 Mbyte of second kernel, and 10 Mbytes into 5 Mbytes of first RAM disk 36 and 5 Mbyte of second RAM disk, respectively. Further, 4M bytes of storage space is allocated as a data backup storage to be used as a flash disk 38.
The space that is allocated as a data backup space for the flash disk 38 is accessed using the MTD (Memory Technology Devices) which is used to access a block device. Therefore, it is possible to use the flash memory as a hard disk. In this case, the backup data that is stored on the flash disk 38 is managed using a JFFS2 (Journaling flash file system version 2) file system as a file and a directory structure. Accordingly, a file can be stored and readout from the flash disk 38 in the unit of sector, which simplifies the memory management.
On the RAM disk 36 of the flash memory, a RAM disk image is stored. The RAM disk image is a file that is designed to have an EXT2 format and any necessary files are put on the RAM disk, and then the contents of the RAM disk are copied as a file format. When a location of a content of the file is designated, a Linux kernel 34 transfers the corresponding content onto the RAM disk 36 while booting. In this case, it is assumed that the RAM disk image is compressed in the kernel 34. The boot loader BOOT copies the compressed RAM disk image into a SDRAM 32, and indicates the location of the image data to the kernel 34 before booting. Thereby, the kernel 34 uses the RAM disk image as a route after booting.
With this structure, in order to secure the flash disk 38 for data backup, the embedded system allocates a memory space for data backup in the entire flask memory in consideration of the reasonable size of the kernel (OS image storage) 34 and the RAM disk (RAM disk image storage) 36. Accordingly, 4 Mbytes space for the flash disk 38 is secured, and the space is formatted. Thereafter, the embedded system performs a mounting process that registers in a system kernel in order to provide as a pass available for the Linux kernel 34 and applications to registers a file system (for example, JFFS2) in the kernel, which embodies the flash disk 38 on the flash memory.
Generally, when the embedded system is turned on, the start code of the booting ROM is executed to initialize the CPU, a memory manager, and on-chip devices and configure a memory map. Thereafter, the boot loader is executed. In the flash memory, a Linux kernel image and an RAM disk image are mounted so as to operate the embedded Linux OS by the boot loader. The kernel image and the RAM disk image mounted in the flash memory are copied and extracted onto the SDRAM through the boot manager BOOTM. After performing the boot loader, the embedded system executes the extracted kernel, recognizes the extracted RAM disk and mounts them.
However, the embedded system according to the related art has complex processes and requires a large amount of time to protect the firmware and data. Further, the embedded system has a drawback in the response ability when irregularity occurs in the embedded system. Therefore, the embedded system according to the related art does not provide a method of protecting the boot loader, the firmware including the kernel image and the RAM disk image, and the data and normally driving the system when the main flash memory is damaged.